﻿#ifndef __DAHUA_GENICAM_IGIGECAMERA_H__
#define __DAHUA_GENICAM_IGIGECAMERA_H__

#include "GenICam/Defs.h"
#include "GenICam/Camera.h"
#include "Infra/String.h"
#include "Memory/SharedPtr.h"

GENICAM_NAMESPACE_BEGIN

class IGigECamera;
typedef Memory::TSharedPtr<IGigECamera> IGigECameraPtr;

/// \~chinese
/// \brief 鐩告満瀵硅薄鎺ュ彛绫?
/// \defgroup GigECamera  GigE鐩告満瀵硅薄鎿崭綔鎺ュ彛
/// \~english
/// \brief	camera object interface class
/// \defgroup GigECamera API for GigEVision Cameras Only
/// @{

/// \~chinese
/// \brief GigE鐩告満瀵硅薄
/// \~english
/// \brief GigE camera object
class GENICAM_API IGigECamera
{
public:

	enum ECameraAccessPermission
	{
		accessPermissionOpen = 0,		///< \~chinese GigE鐩告満娌℃湁琚繛鎺?       ///< \~english The GigE vision device isn't connected to any application. 
		accessPermissionExclusive, 	///< \~chinese 镫崰璁块棶鏉冮檺        ///< \~english Exclusive Access Permission   
		accessPermissionControl, 	///< \~chinese 闱炵嫭鍗犲彲璇昏闂潈闄? ///< \~english Non-Exclusive Readbale Access Permission  
		accessPermissionControlWithSwitchover,  	///< \~chinese Control access with switchover enabled.        ///< \~english Control access with switchover enabled.	
		accessPermissionUnknown = 254,  	///< \~chinese 镞犳硶纭畾        ///< \~english Value not known; indeterminate.   	
		accessPermissionUndefined     	///< \~chinese 链畾涔夎闂潈闄?     ///< \~english Undefined Access Permission
	};

protected:
	/// \~chinese
	/// \brief 鏋愭瀯鍑芥暟
	/// \~english
	/// \brief destruct function 
	virtual ~IGigECamera(){}

public: 
	/// \~chinese
	/// \brief GigE鐩告満瀵硅薄銮峰彇鎺ュ彛锛屽悓涓€涓猚ameraPtr瀵瑰簲镄勬槸鍚屼竴涓狦igE鐩告満瀵硅薄
	/// \param [in] cameraPtr  GigE绫诲瀷镄勭浉链烘櫤鑳芥寚阍埚璞?濡傛灉浼犲叆浜嗗叾瀹冮潪GigE鐩告満绫诲瀷锛岃鎺ュ彛杩斿洖绌烘寚阍?琛ㄧず镞犳晥
	/// \~english
	/// \brief GigE GigE camera object access interface, same cameraPtr is correspond to same GigE camera object
	/// \brief [in] cameraPtr Smart pointer object of GigE camera, if the cameraPtr point to a camera which is not GigE camera, the interface return NULL which means it is invalid
	static  IGigECameraPtr getInstance(const ICameraPtr &cameraPtr);
	
	/// \~chinese
	/// \brief 銮峰彇鐩告満镄刬pAddress
	/// \return 杩斿洖ipAddress 鐩告満镄処P鍦板潃
	/// \~english
	/// \brief	get ipAddress of camera
	/// \return success:return ipAddress of camera, fail:return empty string 
	virtual Infra::CString getIpAddress() const = 0;

	/// \~chinese
	/// \brief 杩斿洖鐩告満镄勫瓙缃戞帺镰?
	/// \return 杩斿洖subnetMask 鐩告満镄勫瓙缃戞帺镰?
	/// \~english
	/// \brief	get subnetMask of camera
	/// \return success:return camera's subnetMask, fail:return empty string 
	virtual Infra::CString getSubnetMask() const = 0;

	/// \~chinese
	/// \brief 杩斿洖鐩告満镄勭綉鍏?
	/// \return 杩斿洖 gateway 鐩告満镄勭綉鍏?
	/// \~english
	/// \brief	get gateway of camera
	/// \return success:return camera's gateway, fail:return empty string 
	virtual Infra::CString getGateway() const = 0;

	/// \~chinese
	/// \brief 銮峰彇鐩告満镄?macAddress
	/// \return 杩斿洖macAddress 鐩告満镄凪ac鍦板潃
	/// \~english
	/// \brief	get macAddress of camera
	/// \return success:return camera's macAddress, fail:return empty string 
	virtual Infra::CString getMacAddress() const = 0;
	
    /// \~chinese
	/// \brief  淇敼璁惧IP
	///1銆佽皟鐢ㄨ鍑芥暟镞跺鏋渘ewSubnetMask鍜宯ewGateway閮借缃简链夋晥链硷紝鍒欎互姝ゆ湁鏁埚€间负鍑?
	///2銆佽皟鐢ㄨ鍑芥暟镞跺鏋渘ewSubnetMask鍜宯ewGateway閮借缃简NULL锛屽垯鍐呴儴瀹炵幇镞剁敤瀹冩墍杩炴帴缃戝崱镄勫瓙缃戞帺镰佸拰缃戝叧浠ｆ浛
	///3銆佽皟鐢ㄨ鍑芥暟镞跺鏋渘ewSubnetMask鍜宯ewGateway涓よ€呬腑鍏朵腑涓€涓负NULL锛屽彟涓€涓潪NULL锛屽垯杩斿洖澶辫触
	/// 璇ユ帴鍙ｅ彧阍埚阃氲绷缃戝崱鎺ュ叆镄勮澶囷紝瀵逛簬鍏朵綑璁惧锛岃皟鐢ㄦ鎺ュ彛镞犳剰涔?
	/// \param [in] newIpAddress 鏂扮殑IP鍦板潃淇℃伅
	/// \param [in] newSubnetMask 鏂扮殑鎺╃爜淇℃伅
	/// \param [in] newGateway 鏂扮殑缃戝叧淇℃伅
	/// \return 鏄惁鎴愬姛
	/// \~english
	/// \brief  modify device IP	
	/// \brief 1銆乄hen callback this function, if the values of newSubnetMask and newGateway are both valid then we consider the value is correct
	/// \brief 2銆乄hen callback this function, if the values of newSubnetMask and newGateway are both NULL, then these values will be replaced by the subnetmask and gateway of NIC which this camera connect to.
	/// \brief 3銆乄hen callback this function, if there is one value of newSubnetMask or newGateway is NULL and the other one is not NULL, then return failed
	/// \brief this interface only serve the devices which is connected to NIC. As for other devices, callback this function won't work and return failed
	/// \param [in] newIpAddress  new IP address 
	/// \param [in] newSubnetMask new SubnetMask
	/// \param [in] newGateway    new Gateway
	/// \retval true  modify IP failed
	/// \retval false modify IP success
	virtual bool forceIpAddress (const char* newIpAddress, const char* newSubnetMask = NULL, const char* newGateway = NULL) = 0;
	
	/// \~chinese
	/// \brief 銮峰彇鐩告満镄勫綋鍓嶈闂潈闄?
	/// \return 濡傛灉銮峰彇鎴愬姛锛岃繑锲炵殑鏋氢妇链间唬琛ㄧ浉链虹殑褰揿墠璁块棶鏉冮檺锛屽鏋滃け璐ワ紝杩斿洖镄勬灇涓惧€间负accessPermissionUnknown
	/// \~english
	/// \brief	get current access permission of camera
	/// \return success:return current access permission of camera, fail:return accessPermissionUnknown 
	virtual ECameraAccessPermission getAccessPermission() const = 0;

    /// \~chinese
    /// \brief 銮峰彇鐩告満镄?Protocol Version
    /// \return 杩斿洖鐩告満镄?Protocol Version锛屽け璐ワ细杩斿洖绌哄瓧绗︿覆
    /// \~english
    /// \brief	get Protocol Version of camera
    /// \return success:return camera's Protocol Version, fail:return empty string 
    virtual Infra::CString getProtocolVersion() const = 0;

    /// \~chinese
    /// \brief 銮峰彇鐩告満镄?IP Configuration
    /// \return 杩斿洖鐩告満镄?IP Configuration锛屽け璐ワ细杩斿洖绌哄瓧绗︿覆
    /// \~english
    /// \brief	get IP Configuration of camera
    /// \return success:return camera's IP Configuration, fail:return empty string 
    virtual Infra::CString getIPConfiguration() const = 0;

	/// \~chinese
	/// \brief 璁剧疆鐩告満瀵箂dk锻戒护镄勫搷搴旇秴镞舵椂闂?
	/// \param [in] timeout 瓒呮椂镞堕棿锛屽崟浣峬s
	/// \return 鏄惁璁剧疆鎴愬姛
	/// \~english
	/// \brief Set the response timeout interval of camera sends command to SDK
	/// \param [in] Timeout interval, unit锛歮s
	/// \retval false Configuration fail
	/// \retval true  Configuration success
	virtual bool setAnswerTimeout(uint16_t timeout) = 0;

	/// \~chinese
	/// \brief 銮峰彇鐩告満镄?IP Configuration options
	/// \return 杩斿洖鐩告満镄?IP Configuration options锛屽け璐ワ细杩斿洖0
	/// \return value:4 鐩告満鍙敮鎸丩LA
	/// \return value:5 鐩告満鏀寔LLA鍜孭ersistent IP
	/// \return value:6 鐩告満鏀寔LLA鍜娈HCP
	/// \return value:7 鐩告満鏀寔LLA銆丏HCP鍜孭ersistent IP
	/// \return value:0 澶辫触
	/// \~english
	/// \brief	get IP Configuration options of camera
	/// \return success:return camera's IP Configuration options, fail:return 0 
	/// \return value:4 camera supports LLA 
	/// \return value:5 camera supports LLA and Persistent IP
	/// \return value:6 camera supports LLA and DHCP
	/// \return value:7 camera supports LLA, DHCP and Persistent IP
	/// \return value:0 fail
	virtual uint32_t getIpConfigOptions() const = 0;

	/// \~chinese
	/// \brief 銮峰彇鐩告満褰揿墠镄?IP Configuration options
	/// \return 杩斿洖鐩告満褰揿墠镄?IP Configuration options锛屽け璐ワ细杩斿洖0
	/// \return value:4 LLA浣胯兘
	/// \return value:5 LLA鍜孭ersistent IP浣胯兘
	/// \return value:6 LLA鍜娈HCP浣胯兘
	/// \return value:7 LLA銆丏HCP鍜孭ersistent IP浣胯兘
	/// \return value:0 澶辫触
	/// \~english
	/// \brief	get current IP Configuration options of camera
	/// \return success:return camera's current IP Configuration options, fail:return 0 
	/// \return value:4 LLA is active
	/// \return value:5 LLA and Persistent IP are active
	/// \return value:6 LLA and DHCP are active
	/// \return value:7 LLA, DHCP and Persistent IP are active
	/// \return value:0 fail
	virtual uint32_t getIpConfigCurrent() const = 0;
};

/// @}

GENICAM_NAMESPACE_END

#endif//__DAHUA_GENICAM_IGIGECAMERA_H__